//
//  PauseView.m
//  MyPopStar
//
//  Created by tarena on 16/1/6.
//  Copyright © 2016年 ssnb. All rights reserved.
//

#import "PauseView.h"

@interface PauseView ()
@property (nonatomic,copy) PauseViewBlock pBlock;
@property (nonatomic,strong) UIButton *btnResume;
@property (nonatomic,strong) UIButton *btnSaveExit;

@end

@implementation PauseView
mdealloc
#pragma  mark -- 初始化
-(instancetype)initWithPauseBlock:(PauseViewBlock) block{
    if (self =[super init]) {
        self.pBlock=block;
        [self btnResume];
        [self btnSaveExit];
    }
    return  self;
}
#pragma mark ---点击事件
-(void)clickResume:(UIButton *)btn{
    if (self.pBlock!=nil) {
        self.pBlock(PauseTypeResume);
    }
}

-(void)clickSaveExit:(UIButton *)btn{
    if (self.pBlock!=nil) {
        self.pBlock(PauseTypeSaveExit);
    }
}
-(void)close:(UIButton *)btn{
    self.hidden=YES;
}

#pragma mark --懒加载
- (UIButton *)btnResume {
	if(_btnResume == nil) {
		_btnResume = [[UIButton alloc] init];
        [_btnResume setBackgroundImage:[UIImage imageNamed:@"resume"] forState:(UIControlStateNormal)];
        [_btnResume addTarget:self action:@selector(clickResume:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_btnResume];
        [_btnResume mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.mas_equalTo(0);
            make.top.left.right.mas_equalTo(0);
            make.height.mas_equalTo(0.0703125*viewHeight);
        }];
        
	}
	return _btnResume;

}

- (UIButton *)btnSaveExit {
	if(_btnSaveExit == nil) {
		_btnSaveExit = [[UIButton alloc] init];
        [_btnSaveExit setBackgroundImage:[UIImage imageNamed:@"save_exit"] forState:(UIControlStateNormal)];
        [_btnSaveExit addTarget:self action:@selector(clickSaveExit:) forControlEvents:(UIControlEventTouchUpInside)];
        [self addSubview:_btnSaveExit];
        
        [_btnSaveExit mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.left.right.mas_equalTo(0);
            make.height.mas_equalTo(0.0703125*viewHeight);
        }];
	}
	return _btnSaveExit;
}

@end
